<?php

namespace App\Http\Controllers\Api\v1;

use App\common;
use App\Http\Controllers\Controller;
use App\Logic\GaoLogic;
use Illuminate\Http\Request;

class Gaocontroller extends Controller
{
    /**
     * 高德地图接口嵌入
     * @yuankai
     */
    public function map(Request $request)
    {
        if ($request->method() == 'GET'){
            try {
                $address = $request->get('city');
                $res = GaoLogic::getCity($address);
                if ($res){
                    return common::success('200',$res,'经纬度');
                }
            }catch (\Exception $exception){
                return common::fail('','',$exception->getMessage());
            }
        }else{
            return common::fail('','','请求方式不正确');
        }
    }
}
